package com.macro.controller;

import com.macro.pojos.dto.LoginDto;
import com.macro.pojos.dto.ResponseResult;
import com.macro.service.UserLoginService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/login")
@Api(tags = "登录管理接口")
public class UserLoginController {
    @Autowired
    UserLoginService loginService;

    /*
    * 发送手机验证码
    * */
    @GetMapping("/sendSms")
    @ApiOperation(value = "发送手机验证码",notes = "发送手机验证码")
    public ResponseResult sendSms(@RequestParam String phoneNumber){
        return loginService.sendSms(phoneNumber);
    }

    /*
    * 用户登录
    * */
    @PostMapping("/userLogin")
    @ApiOperation(value = "用户登陆",notes = "用户登陆")
    public ResponseResult UserLogin(@RequestBody LoginDto loginDto){
        return loginService.UserLogin(loginDto);
    }
}
